import request from "../index";

// 根据活动名称分页查询
export const getFlashList = (
  params: AdminListParams
): RpI<FlashListData<FlashListDataRes>> =>
  request.get("/flash/list", { params });

// 获取全部场次
export const getFlashSessionList = (): RpI<FlashSessionData[]> =>
  request.get("/flashSession/list");

// 添加活动
export const FlashCreate = (data: FlashListDataRes): RpI<number> =>
  request.post("/flash/create", data);

// 获取全部可选场次及其数量
export const getFlashSessionSelectList = (
  params: FlashSessionSelectList
): RpI<FlashSessionData[]> =>
  request.get("/flashSession/selectList", { params });

// 修改上下线状态
export const FlashUpdateStatus = (id: number, status: number): RpI<number> =>
  request.post(`/flash/update/status/${id}?status=${status}`);

// 编辑活动
export const editFlashUpdate = (id: number, data: FlashListDataRes) =>
  request.post(`/flash/update/${id}`, data);

// /flash/delete/{id} 删除活动
export const FlashDelete = (id: number): RpI<number> =>
  request.post(`/flash/delete/${id}`);
